<template>
  <div class="newAlbumlist">
    <div class="list" v-for="(item, index) in newAlbumlist" :key="index" @click="toAlbumDetail(item.id)">
      <div class="img">
        <img :src="item.picUrl" />
        <i class="iconfont icon-playcircle"></i>
      </div>
      <span class="name">{{ item.name }}</span>
      <span class="nickname">{{ item.artists[0].name }}</span>
    </div>
  </div>
</template>

<script>
import { getNewAlbumList } from '../../../network/playlist.js'
export default {
  props: ['area'],
  data () {
    return {
      limit: 100,
      offset: 1,
      type: 'new',
      newAlbumlist: []
    }
  },
  methods: {
    getNewAlbumList (area, type) {
      getNewAlbumList(area, type).then(res => {
        // console.log(res.data)
        this.newAlbumlist = res.data.monthData
        // console.log(this.newAlbumlist)
      })
    },
    toAlbumDetail (id) {
      this.$router.push('/album_detail/' + id)
    }
  },
  created () {
    this.getNewAlbumList(this.area, this.type)
  }
}
</script>

<style lang="less" scoped>
  .newAlbumlist {
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    .list {
      width: 18%;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      box-sizing: border-box;
      margin: 0 1% 20px;
      .img {
        position: relative;
        img {
          width: 100%;
        }
        i {
          position: absolute;
          color: #fff;
          bottom: 5%;
          right: 5%;
          font-size: 0px;
          border-radius: 50%;
          background-color: rgba(0, 0, 0, 0.3);
        }
        i:hover {
          background-color: rgba(0, 0, 0, 0.5);
        }
      }
      .img:hover i {
        font-size: 30px;
      }
      .nickname, .name {
        float: left;
        display: flex;
        justify-content: flex-start;
        font-size: 15px;
        padding: 5px 0;
      }
      .nickname {
        color: #888888;
      }
    }
  }
</style>
